/*
 ============================================================================
 Name		: TradeBlockBankQuery.h
 Author	  : spring xu
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CTradeBlockBankQuery declaration
 ============================================================================
 */

#ifndef TRADEBLOCKBANKQUERY_H
#define TRADEBLOCKBANKQUERY_H

// INCLUDES
#include "TradeBlock.h"
#include "Control.h"
#include "TradeBlockNetwork.h"

// CLASS DECLARATION

class CTradeBlockBankQuery: public CTradeBlock, public MPushButtonObserver //,public MReqObserver
{
public:
    enum TTransferType
    {
        EToSecurity, ESToBank
    };
    
public:
    ~CTradeBlockBankQuery();

    static CTradeBlockBankQuery* NewL(CBaseBlock* bsBack);

    static CTradeBlockBankQuery* NewLC(CBaseBlock* bsBack);

private:
    CTradeBlockBankQuery(CBaseBlock* bsBack);
    
    void ConstructL();

public:
    void OnDraw(CFbsBitGc& g) const;

    void OnKeyDown(TInt keyCode);

    void OnMouseDown(const TPoint& aPt);
    
    void OnMouseUp(const TPoint& aPt);
    
    void OnInput(const TDesC8& strInput);

    void SizeChanged();  
    
    void ChangeFocus(TBool aFoucs, const TInt& keyCode);
    
    void BeforeBack();
    
protected:
    void AddTabs();

    void BeforeDraw(CFbsBitGc& g) const;   
    
private:
    void CreateControls();    
    void LayoutControls();
    
    void Query();
    void ResetData();
    
public:    
    // from MPushButtonObserver
    void PushButtonClicked();
    
public:
	TBool ProcessTradeNetworkMsg(TInt nError, TAny* p, const TDesC8& aBodyData);
	//TBool UpdateTradeNetwork(TInt nProgress);
		
private:
	enum TBankQueryControl
	{
		EBankQueryControl_SelectBoxBank,
		EBankQueryControl_SelectCurrency,
		
		EBankQueryControl_Pwd,
		EBankQueryControl_Amount,
		
		EBankQueryControl_ButtonConfirm,
		EBankQueryControl_ButtonReset,
		
		EBankQueryControlCount
	};
    enum TNetworkStatus
    {
    	ENetworkStatus_None,
    	ENetworkStatus_Req,
    	ENetworkStatus_Resp,
    };
private:
    TTransferType iTransferType;
    
    //CSingleLineTextInput* iBankEdit;
    
    CLabelSelectBox* iBankEdit;
    CLabelSelectBox* iCurrencyEdit;
    //CSingleLineTextInput* iCurrencyEdit;
    CSingleLineTextInput* iAmountEdit;
    CSingleLineTextInput* iPwdEdit;
    
    CPushButton* iButtonConfirm;
    CPushButton* iButtonReset;
    
    CControl* iControls[EBankQueryControlCount];
    TInt iFocusControl;
    
    TInt iNetworkStatus;
};

#endif // TRADEBLOCKTRANSFER_H
